


package com.UMLife.me.ui;

import com.UMLife.me.action.MainMenuAction;
import com.UMLife.me.global.Global;
import de.enough.polish.ui.Choice;
import de.enough.polish.ui.ChoiceGroup;
import de.enough.polish.ui.ChoiceItem;
import de.enough.polish.ui.Container;
import de.enough.polish.ui.Form;
import de.enough.polish.ui.Item;
import de.enough.polish.ui.StringItem;





/**
 * 主菜单类
 * 
 * @author Maycode
 * @version 2009.11.14
 */
public class MainMenu
		extends Form
{
	public MainMenu()
	{
		//#style MainMenu
		super(null);
		
		//#style con
		Container con = new Container(true);
		//#style titleItem
		StringItem titleItem = new StringItem(null, "主菜单", Item.PLAIN);
		
		this.menu = new ChoiceGroup(null, Choice.EXCLUSIVE);
		//#style startItem
		ChoiceItem start = new ChoiceItem("马上答题", null, Choice.EXCLUSIVE);
		//#style startItem
		ChoiceItem rank = new ChoiceItem("幸运榜", null, Choice.EXCLUSIVE);
		//#style startItem
		ChoiceItem score = new ChoiceItem("成绩单", null, Choice.EXCLUSIVE);
		//#style startItem
		ChoiceItem help = new ChoiceItem("帮助", null, Choice.EXCLUSIVE);
		//#style startItem
		ChoiceItem aboutUs = new ChoiceItem("关于我们", null, Choice.EXCLUSIVE);
		this.menu.append(start);
		this.menu.append(rank);
		this.menu.append(score);
		this.menu.append(help);
		this.menu.append(aboutUs);
		con.add(this.menu);
		this.append(Global.getGlobalLogo());
		this.append(titleItem);
		this.append(con);
		
		//杨光添加的按钮事件
		MainMenuAction action = new MainMenuAction(this, this.menu);
		this.setItemStateListener(action);
		this.setCommandListener(action);
	}
	
	/**
	 * 返回当前用户选择哪一项（开始答题，幸运榜，成绩单.....）
	 * 
	 * @return
	 */
	public int getSelected()
	{
		//TODO
		return this.menu.getSelectedIndex();
	}
	
	private ChoiceGroup	menu;
	
}
